package com.hollycrm.ahunicom.sheet.business.logic.hibernate;

import java.util.Properties;

import org.springframework.orm.hibernate.HibernateTemplate;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;

import com.hollycrm.unicom.security.AuthToken;
import com.hollycrm.unicom.sheet.Constants;
import com.hollycrm.unicom.sheet.domain.MainSheet;
import com.hollycrm.unicom.sheet.flow.SheetAction;
import com.hollycrm.unicom.sheet.flowsupport.ActionExecuteLogic;
import com.hollycrm.unicom.sheet.flowsupport.DoOperateContext;

public class HibernateSheetModifySaveLogic extends HibernateDaoSupport implements
		ActionExecuteLogic {
    /**
     * execute
     *
     * @param authToken AuthToken
     * @param action SheetAction
     * @param context DoOperateContext
     */
	private static String customerRE;
	private static String mobileRE;
	protected static String noPattern = "^(15||13)\\d{9}$";
	private static Properties res2 = new Properties();
		public HibernateSheetModifySaveLogic() {
			
		}
    public void execute(AuthToken authToken, SheetAction action, DoOperateContext context) {
        HibernateTemplate ht = getHibernateTemplate();
        String currentTime = (String)context.getOutputAttr("startTime");
        //----------------------------------------------------------------------
        String mainSheetFlowNO = (String) context.getInputAttr("sheetFlowNO");
        String sendDept = (String) context.getInputAttr("sendDept");
        String sendContent = (String) context.getInputAttr("sendContent");
        String assignCompleteTime = (String) context.getInputAttr("assignCompleteTime");
        //----------------------------------------------------------------------
        MainSheet mainSheet = (MainSheet) ht.load(MainSheet.class,
                                                  mainSheetFlowNO);
        mainSheet.setSendFlag(Constants.FALSE);
 
        mainSheet.setStatusChangeTime(currentTime);
        mainSheet.setSendContent(sendContent);
        mainSheet.setStatus(Constants.SHEET_STATUS_TEMP_SAVE);
        //----------------------------------------------------------------------
        ht.update(mainSheet);

    }

}
